From: Keir Fraser Date: Sat, 31 Mar 2007 11:42:02 +0000 (+0100) Subject: linux: Add a hook before a page table entry is cleared, for use with X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15270^2~24 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=7fd0f937ba5af29fb1cfe7622ff4aea6b4133639;p=xen.git linux: Add a hook before a page table entry is cleared, for use with the grant-table device. Signed-off-by: Derek Murray --- diff --git a/linux-2.6-xen-sparse/include/linux/mm.h b/linux-2.6-xen-sparse/include/linux/mm.h index 1368b8450a..19654229cc 100644 --- a/linux-2.6-xen-sparse/include/linux/mm.h +++ b/linux-2.6-xen-sparse/include/linux/mm.h @@ -205,6 +205,11 @@ struct vm_operations_struct { /* notification that a previously read-only page is about to become * writable, if an error is returned it will cause a SIGBUS */ int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); + /* Area-specific function for clearing the PTE at @ptep. Returns the + * original value of @ptep. */ + pte_t (*ptep_get_and_clear_full)(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep, + int is_fullmm); #ifdef CONFIG_NUMA int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); struct mempolicy *(*get_policy)(struct vm_area_struct *vma, diff --git a/linux-2.6-xen-sparse/mm/memory.c b/linux-2.6-xen-sparse/mm/memory.c index f55ed7dedc..4af5beccaa 100644 --- a/linux-2.6-xen-sparse/mm/memory.c +++ b/linux-2.6-xen-sparse/mm/memory.c @@ -659,8 +659,15 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, page->index > details->last_index)) continue; } - ptent = ptep_get_and_clear_full(mm, addr, pte, - tlb->fullmm); + if (unlikely(vma->vm_ops && + vma->vm_ops->ptep_get_and_clear_full)) + ptent = vma->vm_ops-> + ptep_get_and_clear_full(vma, addr, + pte, + tlb->fullmm); + else + ptent = ptep_get_and_clear_full(mm, addr, pte, + tlb->fullmm); tlb_remove_tlb_entry(tlb, pte, addr); if (unlikely(!page)) continue; @@ -755,6 +762,7 @@ static unsigned long unmap_page_range(struct mmu_gather *tlb, details = NULL; BUG_ON(addr >= end); + tlb_start_vma(tlb, vma); pgd = pgd_offset(vma->vm_mm, addr); do {